package com.wangan.wanganpush.stomp.RelinkMap;


import io.netty.util.internal.StringUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 用来缓存已经订阅的长链接 防止重复订阅
 * xufm
 */
public class StompLinkMap {

    public static List<String>  stompLinkMap = new ArrayList<>();


    public Boolean addLink(String linkName){
        if(StringUtil.isNullOrEmpty(linkName)) return false;
        if(stompLinkMap.contains(linkName))  return false;
        stompLinkMap.add(linkName);  return true;
    }


    public Boolean isExit(String linkName){
        if(stompLinkMap.contains(linkName))  return true;
        return false;
    }

    public static List<String> getStompLinkMap() {
        return stompLinkMap;
    }

    public static void setStompLinkMap(List<String> stompLinkMap) {
        StompLinkMap.stompLinkMap = stompLinkMap;
    }
}
